#include "CApp.h"
 
void CApp::OnLoop() {

	//cout<<"Onloop Start: "<<SDL_GetTicks()<<endl;

	//Anim_Leo.OnAnimate();
	CFPS::FPSControl.OnLoop();

	for(int i=0; i<CEntity::EntityList.size(); i++)
	{
		if(!CEntity::EntityList[i])
			continue;

		CEntity::EntityList[i]->OnLoop();
	}

	for(int i=0; i<CEntityCol::EntityColList.size(); i++)
	{
		CEntity* EntityA = CEntityCol::EntityColList[i].EntityA;
		CEntity* EntityB = CEntityCol::EntityColList[i].EntityB;

		if(EntityA == nullptr || EntityB == nullptr)
			continue;

		if(EntityA->OnCollision(EntityB))
			EntityB->OnCollision(EntityA);
	}
	
	CEntityCol::EntityColList.clear();

	//cout<<"Onloop End: "<<SDL_GetTicks()<<endl;
}